tests: fix seo-tap-targets in high DPI #14866
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixes #13557
The failure was
The case was these two elements: (zero width target and passing target)
In taptargets we take each target (eg zero width target) as a rect. then we place a hypothetical 48x48 finger at the center of the rect. Then we see how many pixels of overlap it has with the adjacent target (passing target)
Test said it should be 720 pixels of overlap area, but on a high dpi screen it was 696. They're both right.
In hidpi you can have fractional CSS pixels.. so.. a lot of things are 18.5px tall. And that ends up with a very similar but slightly off result in these rect overlap calculations.
Fixing it with a font-size on the body was a guess. I never understood this whole thing but it probably is related.
The discrepancy above points to a problem with the implementation of emulation. I can repro this difference while emulating DPR=2 on my dpi1 screen and emulating DPR=2 on my dpi2 screen. One says 18px tall, the other 18.5px tall. Thats not supposed to happen. That said, this subtlety probably isn't causing us large problems, so I'm not concerned.